Socket
Socket
Sign inDemoInstall

widest-line

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

widest-line

Get the visual width of the widest line in a string - the number of columns required to display it


Version published
Weekly downloads
12M
decreased by-3.47%
Maintainers
1
Weekly downloads
 
Created

What is widest-line?

The widest-line npm package is designed to find and return the length of the longest line in a string, taking into account and handling ANSI escape codes which are often used for coloring or styling terminal output. This can be particularly useful when trying to format console output or determine the necessary width for a text-based UI component.

What are widest-line's main functionalities?

Get the length of the longest line in a string

This feature allows you to determine the length of the longest line in a given multi-line string, which can be useful for formatting console output or for creating text-based UI components that need to accommodate variable-length content.

"const widestLine = require('widest-line');

const text = 'Some string with\nseveral lines\nand varying lengths.';
const longestLineLength = widestLine(text);
console.log(longestLineLength); // Outputs the length of the widest line"

Other packages similar to widest-line

Keywords

FAQs

Package last updated on 16 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc